package com.ax.business.common.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ax.business.common.dao.BaseDoctorMapper;
import com.ax.business.common.dao.BaseOrgMapper;
import com.ax.business.common.dao.BasePharmacistMapper;
import com.ax.business.common.domain.BaseDoctor;
import com.ax.business.common.domain.BaseOrg;
import com.ax.business.common.domain.BasePharmacist;
import com.ax.business.common.service.OrgInformationService;
import com.ax.business.common.util.PageUtils;
import com.ax.business.common.util.Query;

@Service("OrgInformationService")
public class OrgInformationServiceImpl implements OrgInformationService {

	@Autowired
	BaseDoctorMapper baseDoctorMapper;
	
	@Autowired
	BasePharmacistMapper basePharmacistMapper;
	
	@Autowired
	BaseOrgMapper baseOrgMapper;
	
	/**
	 * 查看医生详情(模块:医生呈现，医生详情*查询某科室下面的医生)
	 * 
	 * @param BaseDoctor baseDoctor
	 *           
	 * @return PageUtils
	 */
	@Override
	public PageUtils queryBaseDoctorSer(Map<String,Object> params){
		Query query = new Query(params);
		List<BaseDoctor> BaseDoctors = baseDoctorMapper.selectByPrimaryKey(query);
		Integer count = baseDoctorMapper.count(query);
		PageUtils pageUtil = new PageUtils(BaseDoctors,count);
		return pageUtil;
	}

	/**
	 * 查看药师详情(模块:药师，药师详情)
	 * 
	 * @param BasePharmacist basePharmacist
	 *           
	 * @return PageUtils
	 */
	@Override
	public PageUtils queryBasePharmacistSer(Map<String, Object> params) {
		Query query = new Query(params);
		List<BasePharmacist> BasePharmacists = basePharmacistMapper.selectByPrimaryKey(query);
		Integer count = basePharmacistMapper.count(query);
		PageUtils pageUtil = new PageUtils(BasePharmacists,count);
		return pageUtil;
	}

	/**
	 * 新增医生详情(模块:医生)
	 * 
	 * @param BaseDoctor baseDoctor
	 *           
	 * @return SUCC
	 */
	@Override
	public void insertBaseDoctorSer(BaseDoctor baseDoctor) {
		baseDoctorMapper.insertSelective(baseDoctor);
	}

	/**
	 * 组织机构查询(模块:组织机构)
	 * 
	 * @param Map<String,Object> map
	 *           
	 * @return BaseOrg baseOrg
	 */
	@Override
	public List<BaseOrg> queryBaseOrgSer(Map<String, Object> parms) {
		List<BaseOrg> baseOrgs = baseOrgMapper.selectByPrimaryKey(parms);
		return baseOrgs;
	}

	/**
	 * 组织机构新增(模块:组织机构)
	 * 
	 * @param BaseOrg baseOrg
	 *           
	 * @return SUCC
	 */
	@Override
	public void insertBaseOrgSer(BaseOrg baseOrg) {
		baseOrgMapper.insertSelective(baseOrg);
	}

	/**
	 * 组织机构修改(模块:组织机构)
	 * 
	 * @param BaseOrg baseOrg
	 *           
	 * @return SUCC
	 */
	@Override
	public void updateBaseOrgSer(BaseOrg baseOrg) {
		baseOrgMapper.updateByPrimaryKeySelective(baseOrg);
	}

	/**
	 * 新增药师详情(模块:医师)
	 * 
	 * @param BasePharmacist basePharmacist
	 *           
	 * @return SUCC
	 */
	@Override
	public void insertBasePharmacistSer(BasePharmacist basePharmacist) {
		basePharmacistMapper.insertSelective(basePharmacist);		
	}
  
}
